<template>
	<view class="goods-item">
		<view class="goods-item-left">
			<radio :checked="isChecked" @click="checkedClick"></radio>
			<image :src="baseUrl + goods.goodsimage" class="goods-pic"></image>
		</view>
		<view class="goods-item-right">
			<view class="goods-name">{{goods.goods_name}}</view>
			<view class="goods-details">{{goods.details}}</view>
			<view class="goods-price">￥<text>{{goods.price}}</text></view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			goods: {
				type: Object,
				default: {}
			},
			isChecked: {
				type: Boolean,
				default: false
			}
		},
		data() {
			return {
				// ischecked:false
				baseUrl: uni.$http.baseUrl
			};
		},
		methods: {
			checkedClick(e) {
				console.log('---checkedClick-----' + this.isChecked);
				this.$emit('checkChange', !this.isChecked)
			}
		}
	}
</script>

<style lang="scss">
	.goods-item {
		display: flex;
		width: 686rpx;
		height: 238rpx;
		background: #FFFFFF;
		border-radius: 24rpx 24rpx 24rpx 24rpx;
		margin-bottom: 24rpx;
		margin-left: 32rpx;
		padding: 28rpx 22rpx;
		// 设置盒模型为 border-box
		box-sizing: border-box;

		.goods-item-left {
			margin-right: 24rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;

			.goods-pic {
				width: 100px;
				height: 100px;
				display: block;
			}
		}

		.goods-item-right {
			display: flex;
			flex: 1;
			flex-direction: column;
			justify-content: space-between;

			.goods-name {
				font-size: 17px;
				font-weight: 700;

			}

			.goods-details {
				display: flex;
				align-items: center;
				justify-content: space-between;
				font-size: 24rpx;
				color: #B7BDC4;
			}

			.goods-price {
				color: #ff590c;
				font-size: 16px;

				text {
					font-size: 20px;
					font-weight: 700;
				}
			}
		}
	}
</style>